package cn.mymall.config;

import cn.mymall.util.FastJsonUtil;
import freemarker.template.Configuration;
import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class FreemarkerConfig {
    @Autowired
    private Configuration configuration;
    @PostConstruct
    public void setSharedVariable() throws TemplateModelException {
        configuration.setSharedVariable("basePath", "/");
        configuration.setSharedVariable("staticPath", "/static/");
        configuration.setSharedVariable("JsonUtil", new FastJsonUtil());
        configuration.setSharedVariable("imagesPath", "https://images.sijiyoufu.com");
    }
}
